//
//  MulModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/5.
//  Copyright © 2016年 YJC. All rights reserved.
//

#import "MulModelCell.h"
#import "UIImageView+WebCache.h"
#import "BigImageView.h"
@interface MulModelCell ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *firstImageView;
@property (weak, nonatomic) IBOutlet UIImageView *secondImageView;
@property (weak, nonatomic) IBOutlet UIImageView *thirdImageView;

@end
@implementation MulModelCell

- (void)setModel:(MulImageModel *)model {
    if (_model != model) {
        _model = model;
    }
}
- (void)layoutSubviews {
    self.titleLabel.text = self.model.title;
    [self.firstImageView sd_setImageWithURL:[NSURL URLWithString:self.model.imgsrc]];
    [self.secondImageView sd_setImageWithURL:[NSURL URLWithString:self.model.imgextra[0][@"imgsrc"]]];
    [self.thirdImageView sd_setImageWithURL:[NSURL URLWithString:self.model.imgextra[1][@"imgsrc"]]];
    
    self.firstImageView.userInteractionEnabled = YES;
    self.secondImageView.userInteractionEnabled = YES;
    self.thirdImageView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(firstImageViewAction:)];
    [self.firstImageView addGestureRecognizer:tap1];
    
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(secondImageViewAction:)];
    [self.secondImageView addGestureRecognizer:tap2];
    
    UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(thirdImageViewAction:)];
    [self.thirdImageView addGestureRecognizer:tap3];
    
}
- (void)firstImageViewAction:(UITapGestureRecognizer *)tap{
    [BigImageView showImage:self.firstImageView];
}
- (void)secondImageViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.secondImageView];
}
- (void)thirdImageViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.thirdImageView];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
